package cn.wolfcode.shop.cloud.util;

import org.apache.commons.codec.digest.DigestUtils;

import java.util.UUID;

//密码加密工具类
public class MD5Util {

    public static String encode(String password,String salt){
        String pass = "" + salt.charAt(0)+salt.charAt(2)+password+salt.charAt(4)+salt.charAt(3);
        return DigestUtils.md5Hex(pass);
    }

    public static void main(String[] args) {
        //截取o-5
        String salt = UUID.randomUUID().toString().replace("-","").substring(0,5);
        System.out.println(salt);
        System.out.println(encode("11111", salt));

    }
}
